home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple Reference & Presen…tion Library 4 (Reseller)
/
Apple Ref. & Pres. Lib.v4.0.iso
/
5-Fonts & Software
/
HyperCard 1.2.5
/
More Stacks
/
Plots
/
background_2620.txt
< prev
next >
Wrap
Text File
|
1989-09-06
|
8KB
|
327 lines
-- background: 2620 from stack: in
-- bmap block id: 2431
-- flags: 0000
-- background id: 0
-- name:
----- HyperTalk script -----
on openBackground
push recent card
end openBackground
function frameheight
return 265
end frameheight
function framewidth
return 395
end framewidth
function framebottom
return 296
end framebottom
function frameleft
return 25
end frameleft
-- part 1 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=0 top=314 right=342 bottom=34
-- title width / last selected line: 0
-- icon id / first selected line: 1014 / 1014
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Prev
----- HyperTalk script -----
on mouseUp
visual effect wipe right
go to previous card
end mouseUp
-- part 2 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=37 top=317 right=342 bottom=69
-- title width / last selected line: 0
-- icon id / first selected line: 21700 / 21700
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Home
----- HyperTalk script -----
on mouseUp
visual effect iris close
go home
end mouseUp
-- part 3 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=440 top=314 right=342 bottom=477
-- title width / last selected line: 0
-- icon id / first selected line: 1012 / 1012
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Return
----- HyperTalk script -----
on mouseUp
visual effect iris close
pop card
end mouseUp
-- part 4 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=479 top=314 right=342 bottom=512
-- title width / last selected line: 0
-- icon id / first selected line: 1013 / 1013
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Next
----- HyperTalk script -----
on mouseUp
visual effect wipe left
go to next card
end mouseUp
-- part 5 (field)
-- low flags: 00
-- high flags: 4007
-- rect: left=440 top=26 right=299 bottom=501
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 65535
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Data
-- part 6 (button)
-- low flags: 00
-- high flags: A003
-- rect: left=76 top=314 right=336 bottom=132
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Bar
----- HyperTalk script -----
on mouseUp
put the userLevel into saveLevel
if the userLevel < 3 then set userLevel to 3 -- "Painting"
if the userLevel < 3 then exit mouseUp
put "Sample Bar Graph" into field "Title"
clearScreen
put empty into background field "total"
reset paint
choose rect tool
set lineSize to 1
set pattern to 14
set filled to true
put frameleft() into horiz
put maxLine(field "Data") into maxValue
put the number of lines in field "Data" into dataCount
put round(framewidth()/dataCount) into horizStep
put round(horizStep * 3/4) into width
repeat with i = 1 to dataCount
get line i of field "data"
if it is not empty then
put round(frameheight() * it / maxValue) into height
drag from horiz,framebottom()-height to horiz+width,framebottom()
end if
add horizStep to horiz
end repeat
reset paint
choose browse tool
set userLevel to saveLevel
end mouseUp
-- part 7 (button)
-- low flags: 00
-- high flags: A003
-- rect: left=137 top=314 right=336 bottom=193
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Coin
----- HyperTalk script -----
on mouseUp
put the userLevel into saveLevel
if the userLevel < 3 then set userLevel to 3 -- "Painting"
if the userLevel < 3 then exit mouseUp
put "Sample Coin Graph" into field "Title"
clearScreen
put empty into background field "total"
reset paint
choose oval tool
set lineSize to 2
set filled to true
put frameLeft() into horiz
put maxLine(field "Data") into maxValue
set cursor to 4 -- watchCursor
put the number of lines in field "Data" into coins
if coins > 10 then
answer "Only the first 10 data items can be plotted." with "OK"
put 10 into coins
end if
repeat with i = 1 to coins
get line i of field "data"
if it is not empty then
put round(frameHeight()/8.2 * it/maxValue) into coinCount
set pattern to 13
drawCoins horiz,frameBottom()-2,coinCount
end if
add 40 to horiz
end repeat
reset paint
choose browse tool
set userLevel to saveLevel
end mouseUp
on drawCoins left,bottom,howMany
put bottom into y
repeat with i = 1 to howMany
subtract 8 from y
drag from left,y to left+30,y+10
end repeat
end drawCoins
-- part 10 (field)
-- low flags: 00
-- high flags: 0004
-- rect: left=257 top=314 right=336 bottom=442
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 20
-- text size: 14
-- style flags: 256
-- line height: 18
-- part name: Title
-- part 8 (button)
-- low flags: 00
-- high flags: A003
-- rect: left=197 top=314 right=336 bottom=253
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Pie
----- HyperTalk script -----
on mouseUp
put the userLevel into saveLevel
if the userLevel < 3 then set userLevel to 3 -- "Painting"
if the userLevel < 3 then exit mouseUp
put "Sample Pie Chart" into field "Title"
put frameBottom()-frameHeight()+10 into pieTop
put frameLeft()+5 into pieLeft
put frameHeight()-20 into pieDiameter
clearScreen
reset paint
choose oval tool
set lineSize to 2
set dragSpeed to 0
drag from pieLeft,pieTop to pieLeft+pieDiameter, pieTop+pieDiameter
set centered to false
put the number of lines in field "Data" into dataCount
put zero into total
repeat with i = 1 to dataCount
add line i of field "Data" to total
end repeat
put "Total is" && total into background field "Total"
put pieDiameter div 2 into pieRadius
put pieLeft+pieRadius into pieCenterX
put pieTop+pieRadius into pieCenterY
choose line tool
put zero into angle
put zero into change
repeat with i = 1 to dataCount+1
put pieCenterX + round(pieRadius * sin(angle)) into x
put pieCenterY - round(pieRadius * cos(angle)) into y
choose line tool
drag from pieCenterX,pieCenterY to x,y
if change > .02 then
set pattern to getPattern(i)
choose bucket tool
click at halfX, halfY
end if
get line i of field "data"
put pi * it / total into change
add change to angle
put pieCenterX + round((pieRadius-3) * sin(angle)) into halfX
put pieCenterY - round((pieRadius-3) * cos(angle)) into halfY
add change to angle
end repeat
reset paint
choose browse tool
set userLevel to saveLevel
end mouseUp
function getPattern selector
return item (selector mod 12)+1 of "2,13,11,3,14,6,21,17,31,18,4,32"
end getPattern
-- part 9 (field)
-- low flags: 00
-- high flags: 0000
-- rect: left=311 top=276 right=294 bottom=429
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Total